<template>
  <div>
    <el-form label-width="120px" :model="form" >
      <el-form-item label="服务器地址">
        <el-input v-model="form.serverUrl"  ></el-input>
      </el-form-item>
      <el-form-item label="应用Key">
        <el-input v-model="form.apiKey"  ></el-input>
      </el-form-item>
      <el-form-item label="应用密钥">
        <el-input v-model="form.secretKey"  ></el-input>
      </el-form-item>
      <el-form-item label="非会员语音模板">
        <el-input v-model="form.template"  type="textarea"></el-input>
      </el-form-item>
      <el-form-item label="会员语音模板">
        <el-input v-model="form.vipTemplate"  type="textarea"></el-input>
      </el-form-item>
      <el-form-item label="到店语音模板">
        <el-input v-model="form.orderTemplate"  type="textarea"></el-input>
      </el-form-item>
      <el-form-item label="购票语音模板">
        <el-input v-model="form.ticketTemplate"  type="textarea"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="handleData" >保存信息</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>

export default {
  data() {
    return {
      form: {
        tip:"",
        signNum:"",
        topicNum:""
      },
      rules: {
        name: [{
          required: true,
          message: "请输入名称",
          trigger: "blur"
        }],
      },
    };
  },
  methods: {
    async handleData() {
      var self = this;
      var param = this.form;
      var res = await this.$http.form("/config/configVoice", param );
      if (res.code == 200) {
        self.$message({
          message: "更新成功",
          type: "success",
        });
      } else {
        self.$message.error(res.msg);
      }
    },
    async loadData() {
      const res = await this.$http.form("/config/voice", {});
      if (res.code === 200) {
        this.form = res.data;
      }
    },
    changePoi(event) {
      console.log(event);
      this.form.lat = event.lat;
      this.form.lng = event.lng;
    },
  },
  mounted() {
    this.loadData();
  },
};
</script>

<style>
</style>
